<?php

class supplier_order{
public function index(){
$order['sid'] = intval($GLOBALS['request']['supplier_id']);
$order['order_nums'] = intval($GLOBALS['request']['nums']);
$order['order_sn'] = to_date(get_gmtime(),'Ymdhis').rand(10,99);
$time =$GLOBALS['request']['time'];
$seat_status= intval($GLOBALS['request']['seat']);
$order['order_tel'] = trim($GLOBALS['request']['tel']);
$order['order_name'] = trim($GLOBALS['request']['name']);
$order['order_sex'] = trim($GLOBALS['request']['sex']);
$order['order_msg'] = htmlspecialchars(addslashes(trim($GLOBALS['request']['msg'])));
$order['user_id'] = intval($GLOBALS['request']['user_id']);
$order['create_time'] = get_gmtime();
$order['deal_type'] = 0;
$root=array();
$order['order_time']=$time;
if(empty($order['order_tel'])){
$root['info']='您好，我们需要知道您的手机号以方便联系您!';
$root['return']=0;
output($root);
}
elseif(!check_mobile($order['order_tel'])){
$root['info']='您好，您的手机号格式不正确!';
$root['return']=0;
output($root);
}
if(empty($order['order_name'])){
$root['info']='您好，我们需要知道您的姓名!';
$root['return']=0;
output($root);
}
$GLOBALS['db']->autoExecute(DB_PREFIX.'supplier_location_order',$order,'INSERT','','SILENT');
$order_id = intval($GLOBALS['db']->insert_id());
if($order_id <=0 ){
$root['info']='处理数据失败，请联系管理员!';
$root['return']=0;
output($root);
}
$root['return']=1;
$root['info']='恭喜您，订餐成功！';
output($root);
}

?>